import { http } from "@/utils/http";

export type LvcGoodsResult = {
  code: number;
  success: boolean;
  msg: string;
  data: Array<any>;
};

//低值易耗品---分页带条件查询功能
export const getListYhp = (data?: object) => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", "/bgyp/lvcGoods/findPage", {
    data
  });
};

//低值易耗品---分页带条件查询功能
export const addYhpList = (data?: object) => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", "/bgyp/lvcGoods/insert", {
    data
  });
};

//获取所有的：低值易耗品类别
export const findCategory = () => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", "/bgyp/lvcCategory/findCategory");
};

//根据类别id查询所有易耗品
export const findCatelog = (id?: object) => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>(
    "post",
    `/bgyp//lvcCatalog/findCatalog/${id}`
  );
};

//根据id修改内容
export const updateYhpList = (data?: object) => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", "/bgyp/lvcGoods/update", {
    data
  });
};

//获取所有的：部门
export const findDept = () => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", "/bgyp/lvcDept/findDept");
};

//根据部门id查询所有人员
export const findUser = (id?: object) => {
  //return http.request<UserResult>("post", baseUrlApi("login"), { data });
  return http.request<LvcGoodsResult>("post", `/bgyp//lvcUser/findUser/${id}`);
};
